package se.cbb.jprime.seqevo;

/**
 * Substitution model definition.
 * TODO: More object-oriented approach (although low prio...).
 * 
 * @author Bengt Sennblad.
 * @author Lars Arvestad.
 * @author Joel Sjöstrand.
 */
public class JTT {

	/**
	 * Returns the model type described by Jones, Taylor and Thornton.
	 * @param cacheSize matrix cache size. Probably not useful with more than twice the number
	 * of arcs in tree...?
	 * @return the model type.
	 */
	public static SubstitutionMatrixHandler createJTT(int cacheSize) {
		double[] Pi = {
				0.077000, 0.051000, 0.043000, 0.052000, 
				0.020000, 0.041000, 0.062000, 0.074000, 
				0.023000, 0.052000, 0.091000, 0.059000, 
				0.024000, 0.040000, 0.051000, 0.069000, 
				0.059000, 0.014000, 0.032000, 0.066000
		};
		double[] R = {
				247.00, 216.00, 386.00, 106.00, 208.00, 600.00, 1183.0, 
				46.000, 173.00, 257.00, 200.00, 100.00, 51.000, 901.00, 
				2413.0, 2440.0, 11.000, 41.000, 1766.0, 
				116.00, 48.000, 125.00, 750.00, 119.00, 614.00, 
				446.00, 76.000, 205.00, 2348.0, 61.000, 16.000, 217.00,
				413.00, 230.00, 109.00, 46.000, 69.000, 
				1433.0, 32.000, 159.00, 180.00, 291.00, 
				466.00, 130.00, 63.000, 758.00, 39.000, 15.000, 31.000,
				1738.0, 693.00, 2.0000, 114.00, 55.000, 
				13.000, 130.00, 2914.0, 577.00, 
				144.00, 37.000, 34.000, 102.00, 27.000, 8.0000, 39.000, 
				244.00, 151.00, 5.0000, 89.000, 127.00, 
				9.0000, 8.0000, 98.000, 
				40.000, 19.000, 36.000, 7.0000, 23.000, 66.000, 15.000, 
				353.00, 66.000, 38.000, 164.00, 99.000, 
				1027.0, 84.000, 
				635.00, 20.000, 314.00, 858.00, 52.000, 9.0000, 395.00, 
				182.00, 149.00, 12.000, 40.000, 58.000, 
				610.00, 
				41.000, 43.000, 65.000, 754.00, 30.000, 13.000, 71.000, 
				156.00, 142.00, 12.000, 15.000, 226.00, 
				41.000, 25.000, 56.000, 142.00, 27.000, 18.000, 93.000, 
				1131.0, 164.00, 69.000, 15.000, 276.00, 
				26.000, 134.00, 85.000, 21.000, 50.000, 157.00, 
				138.00, 6.000, 5.0000, 514.00, 22.000, 
				1324.0, 75.000, 704.00, 196.00, 31.000, 
				172.00, 930.00, 12.000, 61.000, 3938.0,
				94.000, 974.00, 1093.0, 578.00, 
				436.00, 172.00, 82.000, 84.000, 1261.0,
				103.00, 7.0000, 77.000, 
				228.00, 398.00, 9.0000, 20.000, 58.000,
				49.000, 23.000, 
				54.000, 343.00, 8.0000, 17.000, 559.00, 
				36.000, 
				309.00, 39.000, 37.000, 850.00, 189.00,  
				1138.0, 412.00, 6.0000, 22.000, 84.000, 
				2258.0, 36.000, 164.00, 219.00, 
				8.0000, 45.000, 526.00, 
				41.000, 27.000,  
				42.000
		};

		return new SubstitutionMatrixHandler("JTT", SequenceType.AMINO_ACID, R, Pi, cacheSize);
	}
	
}
